package com.hopu.haogoumall.db.mapper;

import com.hopu.haogoumall.db.module.HaogoumallFootprint;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface HaogoumallFootprintMapper {
    @Delete({
        "delete from haogoumall_footprint",
        "where footprint_id = #{footprintId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer footprintId);

    @Insert({
        "insert into haogoumall_footprint (footprint_id, user_id, ",
        "goods_id, footprint_add_time, ",
        "footprint_update_time, footprint_deleted)",
        "values (#{footprintId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
        "#{goodsId,jdbcType=INTEGER}, #{footprintAddTime,jdbcType=TIMESTAMP}, ",
        "#{footprintUpdateTime,jdbcType=TIMESTAMP}, #{footprintDeleted,jdbcType=BIT})"
    })
    int insert(HaogoumallFootprint record);

    @InsertProvider(type=HaogoumallFootprintSqlProvider.class, method="insertSelective")
    int insertSelective(HaogoumallFootprint record);

    @Select({
        "select",
        "footprint_id, user_id, goods_id, footprint_add_time, footprint_update_time, ",
        "footprint_deleted",
        "from haogoumall_footprint",
        "where footprint_id = #{footprintId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="footprint_id", property="footprintId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.INTEGER),
        @Result(column="footprint_add_time", property="footprintAddTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="footprint_update_time", property="footprintUpdateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="footprint_deleted", property="footprintDeleted", jdbcType=JdbcType.BIT)
    })
    HaogoumallFootprint selectByPrimaryKey(Integer footprintId);

    @UpdateProvider(type=HaogoumallFootprintSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(HaogoumallFootprint record);

    @Update({
        "update haogoumall_footprint",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "goods_id = #{goodsId,jdbcType=INTEGER},",
          "footprint_add_time = #{footprintAddTime,jdbcType=TIMESTAMP},",
          "footprint_update_time = #{footprintUpdateTime,jdbcType=TIMESTAMP},",
          "footprint_deleted = #{footprintDeleted,jdbcType=BIT}",
        "where footprint_id = #{footprintId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(HaogoumallFootprint record);
}